<?php
$this->pageHeader = t('LBL_VIEW_PROFILE', 'profile');
$this->pageTitle = t('PAGE_TITLE', 'profile');
$logedInUser = User::model()->findByPk(Yii::app()->user->id);
if($logedInUser->isSubmitter() && $model->submitter != $logedInUser->username)
{
	throw new CHttpException(403, t('MSG_NOT_PERMISSION','messages'));
}

$toolbar = new LGToolbar();
$toolbar->buttonNewPage(t('BTN_PRINT', 'profile'), '', app()->controller->id . '/print/'. $model->id);
if (($logedInUser->isSubmitter() && ($model->status == ProfileStatus::STATUS_NEW || $model->status == ProfileStatus::STATUS_WAITING || $model->status == ProfileStatus::STATUS_REJECTED)) || $logedInUser->isAdmin() || $logedInUser->isSuperAdmin()){
    $toolbar->buttonNewPage(t('LBL_EDIT_PROFILE', 'profile'), '', app()->controller->id . '/update/'. $model->id);    
}
if ($logedInUser->isEditor() || $logedInUser->isAdmin() || $logedInUser->isSuperAdmin()){
    $toolbar->buttonNewPage(t('BTN_REJECT', 'profile'), '', app()->controller->id . '/reject/'. $model->id);   
    if ($model->status == ProfileStatus::STATUS_WAITING){
        $toolbar->buttonNewPage(t('BTN_TRANSLATE', 'profile'), '', '/translate/index', array("id" => $model->id));   
    }else if ($model->status == ProfileStatus::STATUS_TRANSLATING){
        $toolbar->buttonNewPage(t('BTN_EDIT_TRANSLATED', 'profile'), '', '/translate/index', array("id" => $model->id));   
    }
    
}
$toolbar->Cancel('btnCancel',t('BTN_CANCEL'));
$this->pageToolbar = $toolbar->mergeToolbar();
?>
<div class="moreinfo">
	<table>
		<tr>
			<td>Trạng thái: <?php echo t("STATUS_" . $model->status, "profile"); ?></td>
			<td style="width: 50px;"></td>
			<td><?php echo t("HEADER_UPDATE_DATE", "history"); ?></td>
			<td><span><?php echo $model->update_date; ?></span></td>
		</tr>
	</table>
</div>
<?php
   $this->renderPartial('_form', array('model'=>$model));
?>

<?php
Yii::app()->clientScript->registerScript('disableAllControls', '
$(document).ready(function() {               
    $(".profile").find("input[type=text], input[type=password], textarea, select").attr("disabled", "disabled");
    $(".profile").find("input[type=text], input[type=password], textarea, select").parent().addClass("input disabled");
    $(".cbaddnew").remove();    
    $(".hideonview").remove();
    $(".ui-datepicker-trigger").remove();    
});', CClientScript::POS_END);

